package sort.comparison;

/**
 * Created by Yasin H on 2017/7/30.
 */
public class Selection extends Base {

    //shortArrays 2
    //shortArraysR 2
    //middleArrays 3900
    //middleArraysR 3200

    public static void sort(Comparable[] a) {
        int N = a.length;
        for (int i = 0; i < N; i++) {
            int min = i;
            for (int j = i + 1; j < N; j++)
                if (less(a[j], a[min]))
                    min = j;
            swap(a, i, min);
        }
    }

}
